/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package lista11.exercicio1;

import java.util.Random;

/**
 *
 * @author carlos
 */
public class controle {

    public void insereArray() {

        quadrado quad = new quadrado("Quadrado", 4);
        circulo circ = new circulo("Circulo", 6);
        retangulo retan = new retangulo("Retangulo", 5, 8);
        losango losango = new losango("Losango", 9, 11);

        String nomeQ = quad.getNome();
        String perimetroQ = quad.perimetro() + "";
        String areaQ = quad.quadrado() + "";

        String nomeC = circ.getNome();
        String perimetroC = circ.perimetro() + "";

        String nomeP = retan.getNome();
        String perimetoP = retan.perimetro() + "";
        String areaP = retan.arearetangulo() + "";

        String nomeL = losango.getNome();
        String perimetroL = losango.perimetro() + "";
        String areaL = losango.areaLosango() + "";
        String[][] arrayGeometricos = new String[7][2];

        int num_rand;
        Random rand = new Random();

        for (int i = 0; i < 7; i++) {
            num_rand = rand.nextInt(6);
            if (i == 0) {
                while (num_rand > 6) {
                    num_rand = rand.nextInt(6);
                    arrayGeometricos[num_rand][0] = nomeQ + "P ";
                    arrayGeometricos[num_rand][1] = perimetroQ;
                }
            } else if (i == 1) {
                while (num_rand > 6) {
                    num_rand = rand.nextInt(6);
                    arrayGeometricos[num_rand][0] = nomeQ + "A";
                    arrayGeometricos[num_rand][1] = areaQ;
                }
            } else if (i == 2) {
                while (num_rand > 6) {
                    num_rand = rand.nextInt(6);
                    arrayGeometricos[num_rand][0] = nomeC + "P ";
                    arrayGeometricos[num_rand][1] = perimetroC;
                }
            } else if (i == 3) {
                while (num_rand > 6) {
                    num_rand = rand.nextInt(6);
                    arrayGeometricos[num_rand][0] = nomeL + "P ";
                    arrayGeometricos[num_rand][1] = perimetroL;
                }
            } else if (i == 4) {
                while (num_rand > 6) {
                    num_rand = rand.nextInt(6);
                    arrayGeometricos[num_rand][0] = nomeL + "A";
                    arrayGeometricos[num_rand][1] = areaL;
                }
            } else if (i == 5) {
                while (num_rand > 6) {
                    num_rand = rand.nextInt(6);
                    arrayGeometricos[num_rand][0] = nomeQ + "P";
                    arrayGeometricos[num_rand][1] = perimetroQ;
                }
            } else {
                while (num_rand > 6) {
                    num_rand = rand.nextInt(6)+1;
                    arrayGeometricos[num_rand][0] = nomeQ + "A";
                    arrayGeometricos[num_rand][1] = areaQ;
                }
            }

        }

        String listaGeometrica = "";
        for (int i = 0; i < 7; i++) {
            listaGeometrica += arrayGeometricos[i][0] + " - " + arrayGeometricos[i][1] + "\n";
        }
        System.out.println(listaGeometrica);

    }

}
